home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_capi.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  1KB  |  55 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4. import sys
  5. from test import test_support
  6. import _testcapi
  7. for name in dir(_testcapi):
  8.     if name.startswith('test_'):
  9.         test = getattr(_testcapi, name)
  10.         if test_support.verbose:
  11.             print 'internal', name
  12.         
  13.         
  14.         try:
  15.             test()
  16.         except _testcapi.error:
  17.             raise test_support.TestFailed, sys.exc_info()[1]
  18.         except:
  19.             None<EXCEPTION MATCH>_testcapi.error
  20.         
  21.  
  22.     None<EXCEPTION MATCH>_testcapi.error
  23.  
  24.  
  25. def TestThreadState():
  26.     import thread
  27.     import time as time
  28.     if test_support.verbose:
  29.         print 'auto-thread-state'
  30.     
  31.     idents = []
  32.     
  33.     def callback():
  34.         idents.append(thread.get_ident())
  35.  
  36.     _testcapi._test_thread_state(callback)
  37.     time.sleep(1)
  38.     if idents.count(thread.get_ident()) != 3:
  39.         raise test_support.TestFailed, "Couldn't find main thread correctly in the list"
  40.     
  41.  
  42.  
  43. try:
  44.     _testcapi._test_thread_state
  45.     have_thread_state = True
  46. except AttributeError:
  47.     have_thread_state = False
  48.  
  49. if have_thread_state:
  50.     TestThreadState()
  51.     import threading
  52.     t = threading.Thread(target = TestThreadState)
  53.     t.start()
  54.  
  55.